package com.ruipengkj.commons.util;

import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;

import javax.swing.border.AbstractBorder;

public class TopBottomLineBorder extends AbstractBorder{

	private static final long serialVersionUID = 1L;
	private Color lineColor;
	private boolean type;
    public TopBottomLineBorder(Color color, boolean type){
    	this.type = type;
        lineColor = color;
    }

    public void paintBorder(Component c, Graphics g, int x, int y,
                            int width, int height){
    	
        g.setColor(lineColor);
//        g.drawLine(0, 0, c.getWidth(), 0);
        if (type)
        	g.drawLine(0, c.getHeight() - 1, c.getWidth(),c.getHeight() - 1);
        else 
        	g.drawLine(0, 0, c.getWidth(), 0);
    }
}
